package vcp.entity.utility;

import java.util.EnumMap;

import vcp.enums.SiteEnum;
/**
 * 
 * @author VCP team
 *<p> robot manager class </p>
 */
public class RobotManager
{

	private static RobotManager robotManager = new RobotManager();
	/**
	 * getter
	 * @return instance of robot manager 
	 */
	public synchronized static RobotManager getRobotManagerInstance ()
	{
		return RobotManager.robotManager;
	}
	/** 
	 *  map with robot per site
	 */
	private EnumMap <SiteEnum, Robot> sitesRobots;
	/**
	 * getter
	 * @return sites robots
	 */
	private EnumMap <SiteEnum, Robot> getSitesRobots ()
	{
		if ( this.sitesRobots == null )
		{
			this.sitesRobots = new EnumMap <>(SiteEnum.class);
		}

		return this.sitesRobots;
	}
	/**
	 * constructor
	 */
	private RobotManager ()
	{

	}
	/**
	 * getter
	 * @param site
	 * @return site robot
	 */
	public synchronized Robot getSiteRobot ( SiteEnum site )
	{
		if ( ! this.getSitesRobots().containsKey(site) )
		{
			this.getSitesRobots().put(site, new Robot(site));
		}

		return this.getSitesRobots().get(site);
	}
}
